package com.slfx.data.permission.controller;


import com.slfx.data.permission.entity.SystemUsers;
import com.slfx.data.permission.service.SystemUsersService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author: slfx
 * @Date: 2022-12-31
 * @Description:
 **/
@RestController
@RequestMapping("/systemUsers")
public class SystemUsersController {

    @Resource
    private SystemUsersService systemUsersService;

    /**
     * 根据ID获取
     *
     * @param id
     * @return
     */
    @GetMapping("/getById")
    public SystemUsers getById(@RequestParam("id") Long id) {
        SystemUsers users = systemUsersService.getById(id);
        return users;
    }

    /**
     * 新增
     *
     * @param users
     * @return
     */
    @PostMapping("/save")
    public Long save(@RequestBody SystemUsers users) {
        systemUsersService.save(users);
        return users.getId();
    }


}
